package cn.fl.product.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.product.vo.SplStepRebatesVO;
import fl.spl.facade.splrebates.dto.SplStepRebatesInfoDTO;

import java.util.ArrayList;
import java.util.List;

public class SplStepRebatesVOTransform {


    /**
     * PO 转  DTO
     * @param vo SplStepRebatesInfo
     * @return SplStepRebatesInfoDTO
     */
    public static SplStepRebatesInfoDTO toDTO(SplStepRebatesVO vo) {
        SplStepRebatesInfoDTO  dto = null;
        if (vo != null) {
            dto = new SplStepRebatesInfoDTO();
            dto.setId(vo.getId());
            dto.setSplId(vo.getSplId());//SPL_ID
            dto.setSplNm(vo.getSplNm());//SPL_NM
            dto.setStepNum(vo.getStepNum());//STEP_NUM
            dto.setIndateStar(vo.getIndateStar());//INDATE_STAR
            dto.setIndateEnd(vo.getIndateEnd());//INDATE_END
            dto.setIsValid(vo.getIsValid());//IS_VALID
            dto.setIsDel(vo.getIsDel());//IS_DEL
            dto.setIsNew(vo.getIsNew());//IS_NEW
            dto.setCrtUsrNm(vo.getCrtUsrNm());//CRT_USR_NM
            dto.setMdfUsrNm(vo.getMdfUsrNm());//MDF_USR_NM
            dto.setDetailDTOList(StepRebatesDetailVOTransform.toDTOList(vo.getDetailVOList()));
            dto.setIsVipWork(vo.getIsVipWork());

            dto.setCrtTm(vo.getCrtTm());//创建时间
            dto.setCrtUsrId(vo.getCrtUsrId());//创建人
            dto.setMdfTm(vo.getMdfTm());//修改时间
            dto.setMdfUsrId(vo.getMdfUsrId());//修改人
            dto.setPrjStarTm(vo.getPrjStarTm());
            dto.setPrjEndTm(vo.getPrjEndTm());
            dto.setStepRem(vo.getStepRem());

            dto.setBuOrgCd(vo.getBuOrgCd());
            dto.setBuOrgCdNm(vo.getBuOrgCdNm());
        }
        return dto;
    }

    /**
     * DTO 转  PO
     * @param dto SplStepRebatesInfoDTO
     * @return SplStepRebatesInfo
     */
    public static SplStepRebatesVO toVO(SplStepRebatesInfoDTO dto) {
        SplStepRebatesVO vo = null;
        if (dto != null) {
            vo = new SplStepRebatesVO();
            vo.setId(dto.getId());
            vo.setSplId(dto.getSplId());//SPL_ID
            vo.setSplNm(dto.getSplNm());//SPL_NM
            vo.setStepNum(dto.getStepNum());//STEP_NUM
            vo.setIndateStar(dto.getIndateStar());//INDATE_STAR
            vo.setIndateEnd(dto.getIndateEnd());//INDATE_END
            vo.setIsValid(dto.getIsValid());//IS_VALID
            vo.setIsDel(dto.getIsDel());//IS_DEL
            vo.setIsNew(dto.getIsNew());//IS_NEW
            vo.setCrtUsrNm(dto.getCrtUsrNm());//CRT_USR_NM
            vo.setMdfUsrNm(dto.getMdfUsrNm());//MDF_USR_NM
            vo.setDetailVOList(StepRebatesDetailVOTransform.toVOList(dto.getDetailDTOList()));
            vo.setIsVipWork(dto.getIsVipWork());

            vo.setCrtTm(dto.getCrtTm());//创建时间
            vo.setCrtUsrId(dto.getCrtUsrId());//创建人
            vo.setMdfTm(dto.getMdfTm());//修改时间
            vo.setMdfUsrId(dto.getMdfUsrId());//修改人

            vo.setPrjStarTm(dto.getPrjStarTm());
            vo.setPrjEndTm(dto.getPrjEndTm());
            vo.setStepRem(dto.getStepRem());
            vo.setBuOrgCd(dto.getBuOrgCd());
            vo.setBuOrgCdNm(dto.getBuOrgCdNm());
        }
        return vo;
    }

    /**
     * VO集合 转 DTO集合
     * @param list List<SplStepRebatesInfo>
     * @return List<SplStepRebatesInfoDTO>
     */
    public static List<SplStepRebatesInfoDTO> toDTOList(List<SplStepRebatesVO> list) {
        List<SplStepRebatesInfoDTO>  voList = new ArrayList<SplStepRebatesInfoDTO>();
        if(CollectionUtils.isNotEmpty(list)){
            for (SplStepRebatesVO vo : list) {
                voList.add(toDTO(vo));
            }
        }
        return voList;
    }

    /**
     * VO集合 转 DTO集合
     * @param list List<SplStepRebatesInfo>
     * @return List<SplStepRebatesInfoDTO>
     */
    public static List<SplStepRebatesVO> toVOList(List<SplStepRebatesInfoDTO> list) {
        List<SplStepRebatesVO>  voList = new ArrayList<SplStepRebatesVO>();
        if(CollectionUtils.isNotEmpty(list)){
            for (SplStepRebatesInfoDTO dto : list) {
                voList.add(toVO(dto));
            }
        }
        return voList;
    }
}
